package com.ruoyi.logistic.domain.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.logistic.domain.NetworkName;
import lombok.Data;

import java.sql.Timestamp;
import java.time.LocalDateTime;

/**
 * ----天道酬勤----
 * <%@ page contentType="text/html;charset=UTF-8" language="java"%>
 *
 * @author ljf
 * @desc 演示
 */
@Data
public class NetworkPullUniformDto {

    private static final long serialVersionUID = -8296532847560782619L;
    private Integer id;
    private Integer networkNameId;
    private String name;
    private Integer status;
    private String pullUniformObject;
    private String pullUniformDimensionality;
    private String weightSection;
    private String excludedProvince;
    private String transportType;
    private Long createBy;
    private Long updateBy;
    private String memberName;
    private String clientName;



    private CreateTimeDTO createTime;

    public CreateTimeDTO getCreateTime() {
        return createTime;
    }

    public void setCreateTime(CreateTimeDTO createTime) {
        this.createTime = createTime;
    }

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Timestamp updateTime;

    private NetworkName networkName;


    public static class CreateTimeDTO {
        private int date;
        private int hours;
        private int minutes;
        private int month;
        private int nanos;
        private int seconds;
        private long time;
        private int year;

        // Add getters and setters for all fields
        // Alternatively, you can use Lombok or other libraries to generate getters and setters automatically
        // Remember to add @JsonFormat annotation to specify the date format for deserialization
        // You can adjust the format according to your requirements

        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        public Timestamp toTimestamp() {
            LocalDateTime localDateTime = LocalDateTime.of(
                    this.year, this.month + 1, this.date,
                    this.hours, this.minutes, this.seconds, this.nanos
            );
            return Timestamp.valueOf(localDateTime);
        }
    }

}
